
<% content_for :head do -%>
  <%#= javascript_include_tag "admin/index_grid" %>
<% end %>

<% content_for :sidemenu do %>
  <div class='admin_filters'>
    <%= form_tag admin_shopping_users_path, method: 'get', id: "shopping_users_search" do %>
      <p>
        <ul class=' search_boxes'>
          <li><%= label_tag 'first_name' %> <%= text_field_tag :first_name, params[:first_name] %></li>
          <li><%= label_tag 'last_name' %>  <%= text_field_tag :last_name, params[:last_name] %></li>
          <li><%= label_tag 'email' %> <%= text_field_tag :email, params[:email] %></li>
        </ul>
        <div style='text-align:center'>
        <%= submit_tag "Search", name: nil, class: 'button red-button alert' %>
        </div>
      </p>
      <div id="users">
        <%= hidden_field_tag :direction, params[:direction] %>
        <%= hidden_field_tag :sort, params[:sort] %>
        <%= will_paginate @users %>
      </div>
    <% end %>
    <div class='clearfix'></div>
  </div>
<% end %>

<h2>Select User</h2>

<div id="admin_shopping_users_page_wrapper">
  <div id="admin_shopping_users_grid_wrapper" class='column pretty_table'>

      <table>
        <thead>
        <tr class='odd'>
          <th class='column1_header'><%= sortable "first_name" %></th>
          <th><%= sortable "last_name" %></th>
          <th><%= sortable "email" %></th>
          <th>Status</th>
        </tr>
        </thead>
        <% @users.each do |user| %>
          <tr class='<%= cycle("odd", "")%>'>
            <td><%= link_to user.first_name, admin_shopping_users_path(user_id: user.id), method: 'POST' %></td>
            <td><%= user.last_name %></td>
            <td><%= user.email %></td>
            <td><%= user.state %></td>
          </tr>
        <% end %>
      </table>

    <%= will_paginate @users %>

  </div>

</div>
<%= form_tag admin_shopping_users_path, id: 'admin-user-form' do %>
  <%= hidden_field_tag('user_id', nil, id: 'admin-user_id') %>
<% end %>
